package site.wetsion.galio.sdk.handler;

import site.wetsion.galio.sdk.common.UserDetails;
import site.wetsion.galio.sdk.utils.AccessTokenHolder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wetsion
 * @version 1.0
 * @CLassName DefaultUserDetailsGetter
 * @date 2019/3/8 7:01 PM
 */
public class DefaultUserDetailsGetter implements UserDetailsGetter {
    @Override
    public UserDetails handle(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        UserDetails userDetails = AccessTokenHolder.getUserByToken(request.getHeader("x-access-token"));
        return userDetails;
    }
}
